********************************************************************************
* appendix figure 6: rent event studies with 400m treatment radius

********************************************************************************

cd "$main_dir/data"

* run near far w 400m
local max_dist 600 
local iso_dist 400 
local g g 		
use near_far_m`max_dist'_i`iso_dist'_`g',clear

gen zero = 0
egen ring_fe=group(building_id l400)

* switch to 400m treatment radius
drop tx_*
rename tx4_* tx_*
	
reghdfe lrent tx_n3 tx_n2 zero tx_0 tx_1 tx_2 tx_3 /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 &  tx400_min_number>0 &  tx400_min_number>0 ///
	[aweight=building_sample_weight] ,absorb(building_id_year ring_fe) vce(cl building_id)
estimates store near_far

* run near-near with 400m
local max_dist 400
local iso_dist 400
local g g

use near_near_m`max_dist'_i`iso_dist'_`g',clear	

reghdfe lrent tx_n3 tx_n2 zero tx_0 tx_1 tx_2 tx_3 /// 
	i.listing_bedroom i.listing_bathroom ///
	if building_sample==1 & min_number>0  ///
	[aweight=building_sample_weight],absorb(msa_year building_id) vce(cl building_id)
estimates store near_near

coefplot (near_far, msymbol(Sh) mcolor(navy) lcolor(navy) ciopts(lcolor(navy)) recast(connected) offset(-0.05)) ///
	(near_near, msymbol(D) mcolor(maroon) lcolor(maroon) ciopts(lcolor(maroon)) recast(connected) offset(0.05)), ///
	keep(tx* zero) ///			
	vert  ///
	yline(0,lcolor(black) lpattern(dash) lwidth(0.2)) xtitle(Years to treatment) ///
	rename(tx_n3 = "-3" tx_n2 = "-2" tx_n1 = "-1" zero="-1" tx_0 = "0" tx_1 = "1" tx_2 = "2" tx_3 = "3" )  ///
	ytitle("Log(rent)") graphregion(color(white)) bgcolor(white) msymbol(O D) ///
	omitted legend(label(2 "Near-Far Specification") label(4 "Near-Near Specification"))
	

